﻿using System.Data.OleDb;
using DataAccess;

namespace SkynetOLEDBAccess
{
    /// <summary>
    /// DbTypeEnum 的摘要说明。
    /// </summary>
    public class DbTypeEnum : IDbTypeEnum
    {

        public int GetTypeEnum(string dbType)
        {
            switch (dbType.Trim().ToUpper())
            {
                case "BIT":
                    return OleDbType.BigInt.GetHashCode();
                case "BINARY":
                    return OleDbType.Binary.GetHashCode();
                case "BIGINT":
                    return OleDbType.BigInt.GetHashCode();
                case "CHAR":
                    return OleDbType.Char.GetHashCode();
                case "DATETIME":
                    return OleDbType.DBTimeStamp.GetHashCode();
                case "DECIMAL":
                    return OleDbType.Decimal.GetHashCode();
                case "FLOAT":
                    return OleDbType.Double.GetHashCode();
                case "INT":
                    return OleDbType.Integer.GetHashCode();
                case "MONEY":
                    return OleDbType.Decimal.GetHashCode();
                case "TEXT":
                    return OleDbType.LongVarChar.GetHashCode();
                case "TIMESTAMP":
                    return OleDbType.DBTimeStamp.GetHashCode();
                case "VARCHAR":
                    return OleDbType.VarChar.GetHashCode();
            }
            return 0;
        }
    }
}
